<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>订单详情</title>
    <link rel="stylesheet" type="text/css" href="shop/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="shop/css/shopcar.css"/>
    <link rel="stylesheet" type="text/css" href="shop/css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="shop/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="shop/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="shop/sourse/layer/mobile/need/layer.css">


	<link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
    <script src="shop/js/rem.js"></script>
	<script src="/js/jquery/jquery.min.js"></script>

	<script src="/js/bootstrap/js/bootstrap.min.js"></script>
	<script src="/js/plugins/jrender/jrender.js"></script>
	<script src="/js/plugins/dialog/dialog.min.js"></script>
	<script src="/js/common.js"></script>
	<script src="shop/sourse/layer/mobile/layer.js"></script>
	<script type="text/javascript">
            var currentPage = 1;
            var pages;
            var travels;
            $(function () {
                var user = JSON.parse(sessionStorage.getItem("user"));
                var id =user.id;
                //查询某个用户的订单
                $(".loading").addClass("loader-chanage")
                $(".loading").fadeOut(300)

                //发送ajax请求,查询某个用户的酒店订单
                $.get("/hotels/"+id+"/userId",{pageSize:4},function (data) {
                    console.log(data);
                    if(data.list.length==0){
                        $(document).dialog({
                            type : 'confirm',
                            titleText: '亲,您还没有订单',
                            buttons: [
                                {
                                    name: '立即返回',
                                    callback: function() {
                                        window.location.href = "/mine/profiles.html";
                                    }
                                },
                                {
                                    name: '现在去订单',
                                    class: 'dialog-btn-hl',
                                    callback: function() {
                                        window.location.href = "/hotelPage.html";
                                    }
                                }
                            ]
                        });
                        return;
					}
                    //这里拿到的data是订单信息
                    //渲染订单
                    renderView(data);
                    pages=data.pages;
                    travels=data.list;
                });
                $(window).scroll(function () {
                    if(isEnd()){
                        if(currentPage<pages){
                            currentPage++;
                            $.get("/hotels/"+id+"/userId",{currentPage:currentPage,pageSize:4},function (data) {
                                $.merge(travels,data.list);
                                renderView({list:travels});
                            },"json");
                        }else{
                            $(document).dialog({
                                type:"notice",
                                infoText:"已经到底部了",
                                autoClose:1500,
                                position:"center"
                            });
                        }
                    }
                });

            });


            function renderView(data) {
                $(".travels").renderValues(data,{
                    handle:function (ele,value) {
                        $(ele).attr("href","hotelOrderParticulars.html?id=" + value);
                    }
                })
            }


	</script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
	<body>
		<!--header star-->
		<header class="mui-bar mui-bar-nav" id="header">
			<a class="btn" href="/mine/profiles.html">
	            <i class="iconfont icon-fanhui"></i>
	        </a>
	        <h4>订单详情</h4>
	    </header>
	    <!--header end-->
	    
	    <div class="warp warptwo clearfloat travels">
	    	<div class="shopcar clearfloat" render-loop="list">
	    		<div class="list clearfloat fl">
	    			<div class="xuan clearfloat fl">
	    				<div class="radio" > 
						    <label>
						        <input type="checkbox" name="sex" value="" />
						    </label>
						</div>
	    			</div>
	    			<a render-key="list.id" render-fun="handle">
		    			<div class="tu clearfloat fl">
		    				<span></span>
		    				<img render-src="list.coverUrl"/>
		    			</div>
		    			<div class="right clearfloat fl">
		    				<p class="tit over" render-html="list.hotelName"></p>
		    				<!--<p class="fu-tit over">颜色：蓝色  内存：120G</p>-->
							订单状态:<p class="tit over" render-html="list.stateName"></p>
		    				<p class="jifen over" render-html="list.price"></p><p>积分</p>
		    				<div class="bottom clearfloat">
		    					<div class="zuo clearfloat fl">
		    						<ul>
		    						</ul>
		    					</div>
		    					<i class="iconfont icon-lajixiang fr"></i>
		    				</div>
		    			</div>
	    			</a>
	    		</div>
	    	</div>
	    </div>
	    
	    <!--settlement end-->
	    

	</body>

</html>
